home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
st80_r41.lha
/
st80_r41
/
Controller-poll_BugFix.st
< prev
next >
Wrap
Text File
|
1993-07-23
|
2KB
|
67 lines
' NAME Controller-poll_BugFix.st
AUTHOR Bill Voss (voss@cs.uiuc.edu)
FUNCTION Fixes a race condition in Controller under R4.1
ST-VERSIONS ST80 R4.1
PREREQUISITES none
DISTRIBUTION world
VERSION ID 1
VERSION DATE August 22nd, 1992
SUMMARY
Date: Sat, 22 Aug 1992 13:55:07 -0500
From: Bill Voss <voss@cs.uiuc.edu>
To: support@parcplace.com
Subject: BugReport (and fix)
Under ParcRanger at the University of Illinois in Urbana/Champaign.
Smalltalk version Objectworks\Smalltalk(R), Release 4.1 of 15 April 1992
ChangeSet patches OrderedCollection ()
Running on a SUN SparcStation 2 running SUNOS 4.1.2 under OW 3 using tvtwm.
I found a race condition.
My code invokes DialogView confirm:initialAnswer: in a process running
at lowIOPriority. When I pressed-then-released the mouse button instead
of rapidly clicking the mouse button I usually got the notifier.
Unhandled exception: Message not understood: #isInTransition:
copy stack
UndefinedObject(Object)>>doesNotUnderstand:
[] optimized
WidgetController>>controlLoopBody
WidgetController>>controlLoop
WidgetController(Controller)>>startUp
ActionButton(VisualPart)>>startUp
DialogController(Controller)>>controlToNextLevel
DialogController>>controlActivity
DialogController(Controller)>>controlLoop
The optimized [] is from WidgetController beTriggerOnUp.
The problem there is that view is undefined.
I eventually found that in WidgetController>>controlLoopBody
...
[previousState := state.
view isNil ifTrue:[self halt].
self poll.
view isNil ifTrue:[self halt]. "<--- halts here"
state := self buttonPressed.
...
My solution is
From Objectworks\Smalltalk(R), Release 4.1 of 15 April 1992 on 22 August 1992 at 1:17:27 pm'!
!Controller methodsFor: 'basic control sequence'!
poll
"Announce that we are iterating through the polling loop. If
there has been no input for a significant time, wait on a semaphore"
ScheduledControllers checkForEvents.
self view == nil "if the top view was closed"
ifTrue: [ScheduledControllers class closedWindowSignal raiseRequest].
self sensor pollForActivity. "pollForActivity may invoke 'Processor yield'"
self view == nil "check again because we may have lost a race."
ifTrue: [ScheduledControllers class closedWindowSignal raiseRequest]! !